<!DOCTYPE html>
<html>
<head>
	<title></title>
	<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	<link rel="stylesheet" type="text/css" href="/static/css/hw-admin.css">
	<link rel="stylesheet" href="/static/css/lb.css"> 

	<style>
	.main-table-wrap{
		padding: 0 20px;
	}	
	</style>
   	<!--[if lt IE 9]>
    　 <script src="https://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
       <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.js"></script>
    <![endif]-->
</head>
<body>

	<div class="hw-iframe">
		<!-- 顶部标题 -->
        <div class="hw-header-wrapper">
            <div class="hw-header">
                <div class="hw-header__item--left">
                    认证更改记录
                </div>
            </div>
        </div>

        <!-- 顶部筛选 -->
        <div class="hw-filter-wrapper">
			<div class="hw-filter">
				<form method="GET" action="<?=$url ?>">
					<div class="default-filter"> 
						<div class="hw-input-label"> 
							<div class="form-control">
								<div class="hw-search-prevent">
									<input type="text" id="company-name" class="hw-input" placeholder="请输入完整的身份证、姓名" name="screen" value="<?=isset($_GET['screen']) ? $_GET['screen'] : '' ?>">
									<button class="search-btn" type="submit"><i class="iconfont"></i></button>
								</div>
							</div>
						</div>
						<input type="hidden" id="state" name="status" value="">
						<div class="filter-switch" data-status="">更多筛选条件<i style="transform: scale(0.56);" class="iconfont hw-down">&#xe87d;</i><i  style="transform: scale(0.56);" class="iconfont hw-up hide">&#xe87e;</i></div>
					</div>
					<div class="filter-detail" style="display: <?=isset($_GET['start_time']) ? 'block' : 'none' ?>">
						<div class="filter-item">
							<div class="hw-input-label">
								<label class="name" for="">创建时间</label>
								<div class="input-icon-group">
									<input type="text" id="startime" onclick="WdatePicker({maxDate:'#F{$dp.$D(\'endtime\',{d: -1})||\'%y-%M-{%d-1}\'}'})" placeholder="选择日期" name="start_time" value="<?=isset($_GET['start_time']) ? $_GET['start_time'] : '' ?>"  autocomplete="off" disableautocomplete>
									<div class="icon-wrapper">
										<i class="iconfont">&#xe601;</i>
									</div>
								</div>
							</div>
							<div class="hw-input-label">
								<label class="name" for="" style="width: 34px;text-align: center;">——</label>
								<div class="input-icon-group">
									<input type="text" id="endtime" onclick="WdatePicker({minDate:'#F{$dp.$D(\'startime\',{d:1});}',maxDate: '%y-%M-%d'})" placeholder="选择日期" name="end_time" value="<?=isset($_GET['end_time']) ? $_GET['end_time'] : '' ?>"  autocomplete="off" disableautocomplete>
									<div class="icon-wrapper">
										<i class="iconfont">&#xe601;</i>
									</div>
								</div>
							</div>
							<div class="operate-btns">
								<div style="float: left;" class="hw-btn hw-default-btn reset_form"><i style="font-size: 13px;position: relative;left: -2px;" class="iconfont">&#xe629;</i>重置</div>
								<button class="hw-btn"><i class="iconfont">&#xe9df;</i>查询</button>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
		
		<!-- 表格 -->
		<div class="main-table-wrap">
            <form id="table-form" method="POST" action="">
				<table cellspacing="0" cellpadding="0" border="0">  
					<colgroup>
						<col class="col-4">
						<col class="col-9">
						<col class="col-5">
						<col class="col-9">
						<col class="col-5">
						<col class="col-2">
						<col class="col-5"> 
						<col class="col-6">
						<col class="col-8">
					</colgroup>

					<thead>
						<tr>
							<th>序号</th>
							<th>原识别身份证</th>
							<th>原识别姓名</th>
							<th>修改后身份证</th>
							<th>修改后姓名</th>
							<th>凭证</th>
							<th class="hover-th">
								<span>
									<?php if (isset($_GET['status'])): ?>
                                        <?php switch ($_GET['status']) {
                                            case '0':
                                                echo '待处理';
                                                break;

                                            case '1':
                                                echo '有效';
                                                break;

                                            case '2':
                                                echo '驳回';
                                                break;
                                            
                                            default:
                                                echo '状态';
                                                break;
                                        } ?>
                                    <?php else: ?>
                                        待处理
                                    <?php endif ?>
									<i class="iconfont"></i>
								</span>
								<div class="hover-content"> 
									<ul class="info" data-target="#state"> 
                                        <li class="list <?=isset($_GET['status']) && $_GET['status'] == '' ? 'active' : '' ?>" data-value="">全部</li>
                                        <li class="list <?=isset($_GET['status']) ? ($_GET['status'] === '0' ? 'active' : '') : 'active' ?>" data-value="0">待审核</li>
                                        <li class="list <?=isset($_GET['status']) && $_GET['status'] === '1' ? 'active' : '' ?>" data-value="1">有效</li>
                                        <li class="list <?=isset($_GET['status']) && $_GET['status'] === '2' ? 'active' : '' ?>" data-value="2">驳回</li>
                                    </ul>
								</div>
							</th>
							<th>创建时间</th>
							<th>操作</th>
						</tr>
					</thead>
					

					<tbody>
						<?php foreach ($list as $key => $value): ?>
							<tr>
								<td><?=$key+1 ?></td>
								<td><?=$this->unlock($value['old_idNumber']) ?></td>
								<td><?=$value['old_name'] ?></td>
								<td><?=$this->unlock($value['new_idNumber']) ?></td>
								<td><?=$value['new_name'] ?></td>
								<td><span style="cursor: pointer;" class="blue-color" onclick="createPreviewModal('<?=$value['card_img'] ?>')">凭证</span></td>
								<td><?=$value['status'] == 2 ? '驳回' : ($value['status'] == 1 ? '有效' : '待处理') ?></td>
								<td><?=$value['create_time'] ?></td>
								<td class="opt">
									<?php if ($value['status'] == 0): ?>
										<span style="cursor: pointer;" data-id="<?=$value['id'] ?>" class="blue-color have-use"><i class="iconfont">&#xe626;</i>有效</span>
										<a style="cursor: pointer;" data-id="<?=$value['id'] ?>" class="red-color refuse"><i class="iconfont">&#xe620;</i>驳回</a>
									<?php endif ?>
								</td>
							</tr>
						<?php endforeach ?>
					</tbody>
				</table>
			</form>
            <?php $this->load->view('Admin/Page/page'); ?>
		</div>
		
	</div>
	
	<script src="/static/lib/jquery-1.12.4.min.js"></script>
	<script type="text/javascript" src="/static/lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="/static/lib/jquery.form.min.js"></script>
    <script type="text/javascript" src="/static/js/common/util.js"></script>
	<script type="text/javascript" src="/static/js/common/upload.js"></script>
	<script type="text/javascript" src="/static/lib/jquery.validate.js"></script>
	<script type="text/javascript" src="/static/lib/messages_zh.js"></script>
	<script type="text/javascript" src="/static/js/common/validateExtend.js"></script>
	<script type="text/javascript" src="/static/js/common/common.js"></script>
    <!-- <script type="text/javascript" src="/static/lib/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" src="/static/lib/ueditor/ueditor.all.min.js"></script>
	<script type="text/javascript" src="/static/lib/ueditor/addCustomizeDialog.js"></script> -->
	<script>
	  var baseUrl = '<?=base_url()?>';
	var imgModal = $('#img-modal');
    function createPreviewModal(url) {
        if(!url||url==''){
            return;
        }
        var str;
		if (imgModal.length > 0) {
			imgModal.find('.modal-body').find('img').attr('src', url);
			imgModal.removeClass('hide');
			return;
		} 

		str = '<div class="modal hide" id="img-modal">'+
				    '<div class="modal-mask"></div>'+
				    '<div class="modal-content">'+
				        '<div class="modal-header">'+
				            '<i class="iconfont" data-dismiss="modal">&#xe63d;</i>'+
				            '<div class="modal-title">图片预览</div>'+
				        '</div>'+
				        '<div class="modal-body">'+
				        	'<img class="preview-img-box" src="'+ url +'">'+
				        '</div>'+ 
				    '</div>'+
				'</div>';
		$('body').append(str);
		setTimeout(function() {
			imgModal = $('#img-modal');
			imgModal.removeClass('hide');
		}, 20);
	}
	$('#table-form').on('click','.refuse',function(){
		var _this = $(this);
		
        $.confirm({
		   msg: '是否驳回？',
		   confirm: function(){
			   var dataId = _this.data('id');
			   window.location.href = baseUrl + `Admin/Member/cardEditAgree/${dataId}/1`;
		   }
	   })
	  
   })
   $('#table-form').on('click','.have-use',function(){
		var _this = $(this);
		
	   $.confirm({
		   msg: '是否确认认证有效？',
		   confirm: function(){
			   var dataId = _this.data('id');
			   window.location.href = baseUrl + `Admin/Member/cardEditAgree/${dataId}`;
		   }
	   })
   })
	</script>
</body>
</html>